package br.com.hotstar.control;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;

import br.com.hotstar.control.annotation.TreatException;
import br.com.hotstar.model.DAO.UsuarioDAO;
import br.com.hotstar.model.base.Base;
import br.com.hotstar.model.entity.Usuario;
import br.com.hotstar.util.resourceBundle.ResourceBundle;
import br.com.hotstar.util.resourceBundle.annotation.ResourceBundleAnnotation;

//@Transaction
@ResourceBundleAnnotation(bundle = "br.com.hotstar.resource.model.entity", name="entityBase" )
@Named
@RequestScoped
public class Teste implements Base{
	
	@Inject
	ResourceBundle<Teste> resourceBundle;
	 
	@Inject
	private UsuarioDAO uDAO;
	
	
	
	
	private Usuario u = new Usuario();

	@TreatException
	public String salvar(){
		

		
		
		
		u.setNome("oi");
		uDAO.save(u);
		
		System.out.println(resourceBundle.getString("ola"));
		return "ola";
	}

	public Usuario getU() {
		return u;
	}

	public void setU(Usuario u) {
		this.u = u;
	}

	
	
	
}
